package com.itheima.stock.controller;

import com.itheima.stock.api.StockControllerAPI;
import com.itheima.stock.domain.Stock4EvrDayDomain;
import com.itheima.stock.domain.Stock4MinuteDomain;
import com.itheima.stock.domain.StockUpdownDomain;
import com.itheima.stock.entity.StockBlockRtInfo;
import com.itheima.stock.entity.StockBusiness;
import com.itheima.stock.response.ResponseResult;
import com.itheima.stock.service.StockService;
import com.itheima.stock.vo.InnerMarketVO;
import com.itheima.stock.vo.resp.PageResult;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author zby
 * @created 2024-06-23 16:33
 * @description
 */
@RestController
public class StockController implements StockControllerAPI {

    private final StockService stockService;

    public StockController(StockService stockService) {
        this.stockService = stockService;
    }

    @Override
    public ResponseResult<List<StockBusiness>> getStockBusiness() {
        List<StockBusiness> stockBusiness = stockService.getStockBusiness();
        return ResponseResult.ok(stockBusiness);
    }

    //其它省略.....
    /**
     * 获取国内最新大盘指数
     * @return
     */
    @Override
    @GetMapping("/index/all")
    public ResponseResult<List<InnerMarketVO>> innerIndexAll(){
        List<InnerMarketVO> innerMarketVOS = stockService.innerIndexAll();
        return ResponseResult.ok(innerMarketVOS);
    }

    @Override
    public ResponseResult<List<StockBlockRtInfo>> sectorAll() {
        return stockService.sectorAllLimit();
    }

    @Override
    public ResponseResult<List<StockUpdownDomain>> stockIncreaseLimit() {
        return stockService.stockIncreaseLimit();
    }

    @Override
    public ResponseResult<PageResult<StockUpdownDomain>> stockPage(Integer page, Integer pageSize) {
        return stockService.stockPage(page, pageSize);
    }

    @Override
    public ResponseResult<Map> upDownCount() {
        return stockService.upDownCount();
    }

    @Override
    public void stockExport(HttpServletResponse response, Integer page, Integer pageSize) {
        stockService.stockExport(response,page,pageSize);
    }

    @Override
    public ResponseResult<Map> stockTradeVol4InnerMarket() {
        return stockService.stockTradeVol4InnerMarket();
    }

    @Override
    public ResponseResult<Map> getStockUpDown() {
        return stockService.stockUpDownScopeCount();
    }

    @Override
    public ResponseResult<List<Stock4MinuteDomain>> stockScreenTimeSharing(String code) {
        return stockService.stockScreenTimeSharing(code);
    }

    @Override
    public ResponseResult<List<Stock4EvrDayDomain>> getDayKLinData(String stockCode) {
        return stockService.stockCreenDkLine(stockCode);
    }
}